package com.prd.controller;


import com.prd.dto.CustomerCommRecordDTO;
import com.prd.service.CustomerCommRecordService;
import com.prd.util.JsonData;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 客户-来往沟通记录 前端控制器
 * </p>
 *
 * @author o1
 * @since 2023-11-26
 */
@Api(tags={"客户管理-来往沟通记录"})
@RestController
@RequestMapping("/api/customerCommRecord")
public class CustomerCommRecordController {
    private CustomerCommRecordService recordService;

    public CustomerCommRecordController(CustomerCommRecordService recordService) {
        this.recordService = recordService;
    }

    @ApiOperation("客户模块-UNI-新增来往沟通记录")
    @PostMapping(value = "uAdd", produces = "application/json;charset=UTF-8")
    public JsonData uAdd(
            @ApiParam(value = "uAdd") @RequestBody CustomerCommRecordDTO recordDTO) {
        return recordService.uAdd(recordDTO);
    }

    @ApiOperation("客户模块-UNI-移除来往沟通记录")
    @GetMapping("uRemove")
    public JsonData uRemove(@ApiParam(value = "id") @RequestParam(value = "id", defaultValue = "-1") int id) {
        if (recordService.removeById(id))
            return JsonData.buildSuccess();
        else
            return JsonData.buildError("请检查id");
    }
}

